local Mactive = 0
local function RPMenu()
	if input.IsKeyDown(KEY_F2) and Mactive == 0 then
		Mactive = 1
		Menu = vgui.Create("DFrame")
		Menu:SetSize(500,500)
		Menu:SetPos(ScrW()/2-Menu:GetWide()/2, ScrH()/2-Menu:GetTall()/2)
		Menu:SetTitle("RP Menu")
		Menu:ShowCloseButton(false)
		Menu:SetDraggable(false)
		Menu:SetVisible(true)
		Menu:MakePopup()
		
		local Close = vgui.Create("DSysButton", Menu)
		Close:SetType( "close" )
		Close:SetPos(475,1)
		Close:SetSize(20,20)
		Close.DoClick = function()
			Menu:SetVisible(false)
			timer.Simple(0.2, function()
				Mactive = 0
			end)
		end
		
		local Sheet = vgui.Create( "DPropertySheet", Menu )
		Sheet:SetPos( 5, 30 )
		Sheet:SetSize( 490, 460 )
		
		local Classes = vgui.Create("DFrame")
		Classes:SetTitle("Class selection")
		Classes:ShowCloseButton(false)
		Classes:SetDraggable(false)
		
		local Buy = vgui.Create("DFrame")
		Buy:SetTitle("Item shop")
		Buy:ShowCloseButton(false)
		Buy:SetDraggable(false)
		
		local Rules = vgui.Create("DFrame")
		Rules:SetTitle("Roleplaying rules")
		Rules:ShowCloseButton(false)
		Rules:SetDraggable(false)
		
		local Clist = vgui.Create("DPanelList", Classes)
		Clist:SetPos( 335, 40 )
		Clist:SetSize( 135, 375 )
		Clist:SetSpacing( 5 )
		Clist:EnableHorizontal( false )
		Clist:EnableVerticalScrollbar( true )
		
		local Citizen = vgui.Create("DCollapsibleCategory")
		Citizen:SetSize( 125, 25 )
		Citizen:SetExpanded( 0 )
		Citizen:SetLabel( "              Citizen" )
		Clist:AddItem(Citizen)
		
		local CitList = vgui.Create("DPanelList")
		CitList:SetSpacing( 5 )
		CitList:EnableHorizontal( true )
		CitList:SetSize(100, 130)
		
		local CitizenModels = {
		"models/player/Group01/male_07.mdl",
		"models/player/Group01/Male_01.mdl",
		"models/player/Group01/Female_01.mdl",
		"models/player/Group01/Female_07.mdl"
		}
		
		for k,v in pairs(CitizenModels) do
			local CitModel = vgui.Create("SpawnIcon")
			CitModel:SetModel(v)
			CitModel.DoClick = function()
				Menu:SetVisible(false)
				RunConsoleCommand("rp_citizen")
				RunConsoleCommand("rp_selmodel", v)
				LocalPlayer():EmitSound("beep.wav")
				timer.Simple(0.2, function()
					Mactive = 0
				end)
			end
			CitList:AddItem(CitModel)
		end
		
		Citizen:SetContents(CitList)

		local Geek = vgui.Create("DCollapsibleCategory")
		Geek:SetSize( 125, 25 )
		Geek:SetExpanded( 0 )
		Geek:SetLabel( "               Geek" )
		Clist:AddItem(Geek)

		local GeekList = vgui.Create("DPanelList")
		GeekList:SetSpacing( 5 )
		GeekList:EnableHorizontal(true)
		GeekList:SetSize(100,65)
		
		local GeekModels = {
		"models/player/Hostage/Hostage_01.mdl",
		"models/player/Hostage/Hostage_04.mdl"
		}
		
		for k,v in pairs(GeekModels) do
			local GeekModel = vgui.Create("SpawnIcon")
			GeekModel:SetModel(v)
			GeekModel.DoClick = function()
				Menu:SetVisible(false)
				RunConsoleCommand("rp_geek")
				RunConsoleCommand("rp_selmodel", v)
				LocalPlayer():EmitSound("beep.wav")
				timer.Simple(0.2, function()
					Mactive = 0
				end)
			end
			GeekList:AddItem(GeekModel)
		end
		
		Geek:SetContents(GeekList)

		
		
		local CDes = vgui.Create("DLabel", Classes)
		CDes:SetText("Citizen:\nThe citizen dosen't have any job,\n but are willing to do almost anything to earn money.")
		CDes:SetPos(15,35)
		CDes:SizeToContents()

		local GDes = vgui.Create("DLabel", Classes)
		GDes:SetText("Geek:\n01010111 01101001 01110010\n01100101 01001101 01101111 01100100")
		GDes:SetPos(15,90)
		GDes:SizeToContents()
		
		Sheet:AddSheet( "Classes", Classes ,"gui/silkicons/user", false, false )
		Sheet:AddSheet( "Buy", Buy, "gui/silkicons/box", false, false )
		Sheet:AddSheet( "Rules", Rules, "gui/silkicons/exclamation", false, false )
	end
end
hook.Add("Think", "CLRPMenu", RPMenu)